<template>
  <div class="welcome">
    <el-container>
      <el-header>
        <div class="logo">
          <img
            src="http://destiny001.gitee.io/admin-dist/img/logo.b5a855ee.png"
            alt=""
          />
          <span>杭州24期后台管理系统</span>
        </div>
        <el-button plain @click="quit">退出</el-button>
      </el-header>
      <el-container>
        <el-aside :width="isCollapse ? '64px' : '200px'">
          <el-radio-group>
            <div @click="isCollapse = !isCollapse" class="toggleMenu">lll</div>
          </el-radio-group>
          <el-menu
            class="el-menu-vertical-demo"
            background-color="#333744"
            :unique-opened="true"
            :collapse-transition="false"
            text-color="#fff"
            :router="true"
            :collapse="isCollapse"
          >
            <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-user-solid"></i>
                <span>用户管理</span>
              </template>
              <el-menu-item index="/userlist">
                <template slot="title">
                  <i class="el-icon-menu"></i>
                  <span>用户列表</span>
                </template>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title">
                <i class="el-icon-key"></i>
                <span>权限管理</span>
              </template>
              <el-menu-item index="/roles">
                <template slot="title">
                  <i class="el-icon-menu"></i>
                  <span>角色列表</span>
                </template>
              </el-menu-item>
              <el-menu-item index="/rights">
                <template slot="title">
                  <i class="el-icon-menu"></i>
                  <span>权限列表</span>
                </template>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="3">
              <template slot="title">
                <i class="el-icon-shopping-cart-2"></i>
                <span>商品管理</span>
              </template>
              <el-menu-item index="/goods">
                <template slot="title">
                  <i class="el-icon-menu"></i>
                  <span>商品列表</span>
                </template>
              </el-menu-item>
              <el-menu-item index="/params">
                <template slot="title">
                  <i class="el-icon-menu"></i>
                  <span>分类参数</span>
                </template>
              </el-menu-item>
              <el-menu-item index="/categories">
                <template slot="title">
                  <i class="el-icon-menu"></i>
                  <span>商品分类</span>
                </template>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="4">
              <template slot="title">
                <i class="el-icon-place"></i>
                <span>订单管理</span>
              </template>
              <el-menu-item index="/orders">
                <template slot="title">
                  <i class="el-icon-tickets"></i>
                  <span>订单列表</span>
                </template>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="5">
              <template slot="title">
                <i class="el-icon-data-line"></i>
                <span>数据统计</span>
              </template>
              <el-menu-item index="/reports">
                <template slot="title">
                  <i class="el-icon-tickets"></i>
                  <span>数据报表</span>
                </template>
              </el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isCollapse: false
    }
  },

  created () {},

  methods: {
    quit () {
      localStorage.removeItem('userinfo')
      this.$router.push('/login')
    }
  }
}
</script>

<style scoped lang="less">
.welcome {
  min-width: 1200px;
  width: 100%;
  height: 100%;
  background-color: #eaedf1;
  header {
    height: 60px;
    display: flex;
    align-items: center;
    background: #373d41;
    justify-content: space-between;
    padding: 0 20px;
    .logo {
      height: 60px;
      line-height: 60px;
      img {
        float: left;
        height: 60px;
      }
      span {
        float: left;
        display: inline-block;
        height: 60px;
        font-size: 25px;
        color: #fff;
        margin-left: 8px;
        line-height: 60px;
      }
    }
  }
  .el-container {
    width: 100%;
    height: 100%;
    .el-aside {
      background: #333744;
      overflow: hidden;
      .el-radio-group {
        width: 100%;
        height: 40px;
        font-size: 10px;
        .toggleMenu {
          width: 100%;
          height: 40px;
          line-height: 40px;
          text-align: center;
          background: #666;
          letter-spacing: 5px;
          color: #fff;
          cursor: pointer;
          user-select: none;
        }
      }
    }
  }
}
</style>
